'use strict';

let debug = require('debug')('news');
let esDao = new require('./es/News.js')();

let DaoDispatcher = function() {};
module.exports = new DaoDispatcher();

let theProto = DaoDispatcher.prototype;

/**
 * 添加单个
 {
    "title":"xxx",
    "content":"xxx"
 }
 * @param inParams
 * @returns {*}
 */
theProto.addOne = function*(inParams) {
    let result = yield esDao.create(inParams);
    return result;
};

theProto.addMany = function*(list) {
    let result = yield esDao.createMany(list);
    return result;
};

theProto.termFreq = function*(field, topNum) {
    let result = yield esDao.termFreq(field, topNum);
    return result;
};

theProto.qSearch = function*(q) {
    let result = yield esDao.qSearch(q);
    return result;
};